<div class="bjui-pageContent">
    <form id="form-change-password" action="{{ url('admin/user/change-password') }}" data-toggle="validate" method="post" data-close-current="true">
        <input type="hidden" name="user_id" value="{{ $userId }}">
        <div class="bjui-row col-1" style="padding:20px;width:500px;">
            <label class="row-label">角色：</label>
            <div class="row-input">{{ $roleName }}</div>
            <label class="row-label">登陆账号：</label>
            <div class="row-input">{{ $username }}</div>
            <label class="row-label">旧密码：</label>
            <div class="row-input required">
                <input type="password" id="j_userinfo_changepass_oldpass" name="old_password" value="" data-rule="required">
            </div>
            <label class="row-label">新密码：</label>
            <div class="row-input required">
                <input type="password" id="j_userinfo_changepass_newpass" name="password" value="" data-rule="新密码:required;length(6~)">
            </div>
            <label class="row-label">确认密码：</label>
            <div class="row-input required">
                <input type="password" id="j_userinfo_changepass_confirmpass" name="password_confirmation" value="" data-rule="required;match(#j_userinfo_changepass_newpass)">
            </div>
        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="check">确认修改</button></li>
    </ul>
</div>
<script>
    $(function () {
        $('#form-change-password').submit(function () {
            var j_userinfo_changepass_oldpass   = $('#j_userinfo_changepass_oldpass').val();
            var j_userinfo_changepass_newpass = $('#j_userinfo_changepass_newpass').val();
            var j_userinfo_changepass_confirmpass = $('#j_userinfo_changepass_newpass').val();
            if (j_userinfo_changepass_oldpass !== '') {
                var j_userinfo_changepass_oldpass_md5 = CryptoJS.MD5(j_userinfo_changepass_oldpass);
                $('#j_userinfo_changepass_oldpass').val(j_userinfo_changepass_oldpass_md5);
            }
            if (j_userinfo_changepass_newpass !== '') {
                var j_userinfo_changepass_newpass_md5 = CryptoJS.MD5(j_userinfo_changepass_newpass);
                $('#j_userinfo_changepass_newpass').val(j_userinfo_changepass_newpass_md5);
            }
            if (j_userinfo_changepass_confirmpass !== '') {
                var j_userinfo_changepass_confirmpass_md5 = CryptoJS.MD5(j_userinfo_changepass_confirmpass);
                $('#j_userinfo_changepass_confirmpass').val(j_userinfo_changepass_confirmpass_md5);
            }
        });
    });
</script>